package com.cxb.servicemap.controller;

import com.cxb.internalcommon.dto.ResponseResult;
import com.cxb.internalcommon.responese.TerminalResponse;
import com.cxb.servicemap.remote.TerminalClient;
import com.cxb.servicemap.service.TerminalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/terminal")
public class TerminalController {

    @Autowired
    private TerminalService terminalService;

    /**
     * 添加终端
     * @param name
     * @return
     */

    @PostMapping("/add")
    public ResponseResult<TerminalResponse> addTerminal(String name,String desc){
        return terminalService.addTerminal(name,desc);
    }

    /**
     * 搜索周边
     * @param center
     * @param radius
     * @return
     */
    @PostMapping("/aroundsearch")
    public ResponseResult<List<TerminalResponse>> aroundsearch(@RequestParam String center,@RequestParam Integer radius){
        return terminalService.aroundsearch(center,radius);
    }
}
